#pragma once

#include "Misc/EngineEditorMacros.h"
#include "Object/Object.h"
#include "Misc/EngineEditorMacros.h"
#include "EditorWindowView.m.h"

class REditorWindowViewModel;
class RWindow;
class RWidget;
class REditorPageAreaManagerView;

//view  of a EditorWindow
//this is base class of all window views
//do not directly use this class
RCLASS(ExtraHeader=["Widgets/Window.h","Widgets/Widget.h","PageArea/EditorPageAreaManagerView.h"])
class REditorWindowView : public RObject
{
    ROBJECT

public:
    virtual void BindViewModel(TSharedObjectPtr<REditorWindowViewModel> InViewModel);
    TSharedObjectPtr<REditorWindowViewModel> GetViewModel();
    void UnbindViewModel();
    void NotifyCloseButtonClicked()
    {
        OnCloseButtonClicked.ExecuteIfBound();
    }
    TDelegate<void> OnCloseButtonClicked;

protected:
    TWeakObjectPtr<REditorWindowViewModel> BaseViewModel;

    RFIELD()
    TSharedObjectPtr<RWindow> Window;
    void CreateAndShowWindow();

    RFIELD()
    TSharedObjectPtr<RWidget> WindowButtonsWidget;
    RFIELD()
    TSharedObjectPtr<RWidget> WindowContentWidget;

    TSharedObjectPtr<REditorPageAreaManagerView> GetPageArea();
protected:
    RFIELD()
    TSharedObjectPtr<REditorPageAreaManagerView> PageAreaView;

};
